package com.xgq.drink.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xgq.drink.entity.Product;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xgq.drink.entity.dto.ProductVO;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author xgq
 * @since 2025-02-23
 */
public interface IProductService extends IService<Product> {
    // 分页查询商品
    IPage<Product> getProductList(Page<Product> page);
    int logicDeleteProduct(Long productId, Long brandId);
    // 根据分类查询商品（带分页）
    IPage<Product> getProductListByCategory(Page<Product> page, Long categoryId);

    // 根据商品 ID 查询商品详情
    Product getProductDetailById(Long productId);

    boolean saveProductWithAttributes(Product product);
    public IPage<Product> getProductListByBrandId(Page<Product> page, Long brandId);

    boolean existsProduct(Long productId);
    public int updateProduct(Product product);
    // 在 IProductService 接口中添加
    IPage<Product> getProductListWithConditions(Page<Product> page, String productName,
                                                Double minPrice, Double maxPrice, Long categoryId);

    IPage<Product> getBrandProductsWithConditions(Page<Product> page, Long brandId, String productName,
                                                  Long productId, Long categoryId, Double minPrice, Double maxPrice, LocalDateTime updateTime);
    public IPage<Product> getRecommendations(Page<Product> page, Long userId);

    IPage<Product> getProductsByCategoryTree(Page<Product> page, Long categoryId);
    Map<String, Object> getProductViewStats(LocalDateTime startTime, LocalDateTime endTime);
    Map<String, Object> getProductOrderStats(LocalDateTime startTime, LocalDateTime endTime);
    Map<String, Object> getProductPaymentStats(LocalDateTime startTime, LocalDateTime endTime);
}

